package db

const TableNameRole = TablePrefix + "role"

type Role struct {
	BaseModel
	UID         uint      `gorm:"column:uid;type:int(11);default:0;comment:用户id" json:"uid" form:"uid"`                               // 用户id
	Nickname    string    `gorm:"column:nickname;type:varchar(50);default:'';comment:昵称" json:"nickname" form:"nickname"`             // 昵称
	Avatar      string    `gorm:"column:avatar;type:varchar(50);default:'';comment:头像" json:"avatar" form:"avatar"`                   // 头像
	ClubID      uint      `gorm:"column:club_id;type:int(11);default:0;comment:俱乐部id" json:"club_id" form:"club_id"`                  // 俱乐部id
	IsVIP       bool      `gorm:"column:is_vip;type:tinyint(1);default:0;comment:是否是vip" json:"isVIP" form:"isVIP"`                   //是否是vip
	VipTerm     int64     `gorm:"column:vip_term;type:int(11);default:0;comment:vip期限" json:"vipTerm" form:"vipTerm"`                 //vip期限
	IsTransfer  bool      `gorm:"column:is_transfer;type:tinyint(1);default:0;comment:是否开启转赠" json:"isTransfer" form:"isTransfer"`    //是否开启转赠
	IsCard      bool      `gorm:"column:is_card;type:tinyint(1);default:0;comment:是否开启转赠卡包" json:"isCard" form:"isCard"`              //是否开启转赠卡包
	OffTransfer bool      `gorm:"column:off_transfer;type:tinyint(1);default:0;comment:1=关闭转赠" json:"offTransfer" form:"offTransfer"` //1=关闭转赠
	LevelID     RoleLevel `gorm:"column:level_id;type:int(11);default:0;comment:1有效用户,2领主,3域主,4界主" json:"level_id" form:"level_id"`   // 1有效用户,2领主,3域主,4界主
	IsUse       bool      `gorm:"column:is_use;type:tinyint(1);default:0;comment:大逃杀是否使用" json:"isUse" form:"isUse"`                  //大逃杀是否使用
}

func (*Role) TableName() string {
	return TableNameRole
}

type RoleLevel int

const (
	RoleNone RoleLevel = iota //无
	RoleZs                    //有效用户
	RoleLz                    //领主
	RoleYz                    //域主
	RoleJz                    //界主
)

type RoleHasOneTransferConfig struct {
	Role
	ChamberMember ChamberMemberHasOneLevel `gorm:"foreignKey:UID;references:UID" json:"chamberMember"`
}
